package com.dufang.myarray;

import java.util.Arrays;

public class Demo01System {
    public static void main(String[] args) {
        arraycopy();
        currentTimeMillis();
        exit();

    }

    /**
     * System.arraycopy();数组复制
     */
    private static void arraycopy(){
        int[] arr1={1,2,3,4,5};
        int[] arr2=new int[10];
        System.arraycopy(arr1,0,arr2,0,5);

        Arrays.stream(arr2).forEach(element-> System.out.print(element+" "));
        Arrays.stream(arr2).forEach(System.out::print);
        System.out.println(Arrays.toString(arr2));
        /*for(int i=0;i<arr2.length;i++){
            System.out.println(arr2[2]+"  ");
        }*/
    }

    private static void exit(){
        for (int i = 0; i < 100; i++) {
            if(i==5){
                System.exit(0);
            }
            System.out.println("helloWorld"+i);
        }
    }

    private static void currentTimeMillis(){
        long time=System.currentTimeMillis();
        System.out.println("time= "+time);
    }

}
